/**************************************************************
 *@ProjectName: blweibo
 *@FileName: WeiboApplication.java
 *@Date: 2011-5-31
 *@Copyright: 2011 www.hrbanlv.com Inc. All rights reserved.
 **************************************************************/
package com.zhiweibo;

import android.app.Application;

import com.zhiweibo.models.StaticInfo;
import com.zhiweibo.util.Constant;
import com.zhiweibo.util.CustomException;

/**
 * The Class WeiboApplication.
 * 
 * @author SunHaibin
 * @since Android 1.6
 * @history 2011-5-31
 */
public class WeiboApplication extends Application {
    
    /** The HEIGHT. */
    public static int HEIGHT;
    
    /** The WIDTH. */
    public static int WIDTH;

    /* (non-Javadoc)
     * @see android.app.Application#onCreate()
     */
    @Override
    public void onCreate() {
        super.onCreate();
        CustomException customException = CustomException.getInstance();
        customException.init(getApplicationContext());
        StaticInfo.mUsername = getSharedPreferences(Constant.FILE_NAME, 0).getString("username", "");
        StaticInfo.mPassword = getSharedPreferences(Constant.FILE_NAME, 0).getString("password", "");
        StaticInfo.mNickName = getSharedPreferences(Constant.FILE_NAME, 0).getString("nickname", "");
        StaticInfo.mUid = getSharedPreferences(Constant.FILE_NAME, 0).getString("uid", "");
    }

    /**
     * Gets the title display mode.
     * 
     * @return the title display mode
     */
    public static int getTitleDisplayMode() {
        if (HEIGHT >= 800 || WIDTH >= 800) {
            return 0;
        } else if (HEIGHT < 320 || 240 > WIDTH) {
            return 2;
        }
        return 1;
    }

    /**
     * Sets the display.
     * 
     * @param paramInt1
     *            the param int1
     * @param paramInt2
     *            the param int2
     */
    public static void setDisplay(int paramInt1, int paramInt2) {
        HEIGHT = paramInt2;
        WIDTH = paramInt1;
    }
}
